#ifndef MDTX_USE_RCPPARMADILLO
#define MDTX_USE_RCPPARMADILLO
#endif

#include <RcppArmadillo.h>
using namespace Rcpp;

#include "mdtx-online/indicator/indicator_type_filter.h"
using namespace mdtx::online;

#include "indi_common.h"

using highpass_ = indi1<indicator::highpass>;

//' Discrete-time first-order high-pass filter
//'
//' @param x Numeric vector to filter
//' @param a Double factor, equals to RC / (RC + delta_T), where RC is time constant
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector highpass(NumericVector x, double a)
{
    auto c = highpass_::create_t(a);
    return highpass_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP highpass_new(double a)
{
    return highpass_::create(a);
}

// [[Rcpp::export(rng = false)]]
NumericVector highpass_run(SEXP ptr, NumericVector x)
{
    return highpass_::run(ptr, x);
}

using lowpass_ = indi1<indicator::lowpass>;

//' Discrete-time first-order low-pass filter
//'
//' @param x Numeric vector to filter
//' @param a Double factor, equals to delta_T / (RC + delta_T), hwere RC is time constant
//' @return Numeric vector
//' @export
// [[Rcpp::export(rng = false)]]
NumericVector lowpass(NumericVector x, double a)
{
    auto c = lowpass_::create_t(a);
    return lowpass_::run_t(c, x);
}

// [[Rcpp::export(rng = false)]]
SEXP lowpass_new(double a)
{
    return lowpass_::create(a);
}

// [[Rcpp::export(rng = false)]]
NumericVector lowpass_run(SEXP ptr, NumericVector x)
{
    return lowpass_::run(ptr, x);
}
